package com.example.bidserver.manager;

import com.example.bidserver.entity.Bid;
import com.example.bidserver.mapper.BidMapper;
import com.example.bidserver.params.PageBidParams;
import com.example.bidserver.vo.BidVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BidManager {
    @Autowired
    private BidMapper bidMapper;
    public void insertBid(Bid bid){
        bidMapper.insert(bid);
    }
    public void deleteBid(String id){
        bidMapper.deleteById(id);
    }

    public void updateBid(Bid bid){
        bidMapper.updateById(bid);
    }
    public List<BidVO> listBidByUserId(PageBidParams pageBidParams){
        return bidMapper.listBidByUserId(pageBidParams);
    }
    public List<BidVO> listBidByPostId(PageBidParams pageBidParams){
        return bidMapper.listBidByPostId(pageBidParams);
    }
    public List<BidVO> listBidByGoodsId(PageBidParams pageBidParams){
        return bidMapper.listBidByGoodsId(pageBidParams);
    }

    public Bid getById(String id) {
        return bidMapper.selectById(id);
    }
}
